<!-- 
 *  Copyright [2014] UW-Parkside
 * Authors: Jasmine Griffiths, Matthew Zygowicz, Armando Narvaez
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/
-->

<!-- "route.php" is the main screen for selecting a route-->
<body>
   <?php
      if (strlen($errMsg) > 0) {//Display an error message, if there is one.
          print "<div class='alert-box error'>";
          print "<strong>Error!</strong>";
          print "<p>";
          print $errMsg;
          print "</p>";
          print "</div>";
      }
         if (strlen($successMsg) > 0) {//Display a successful message, if there is one.
          print "<div class='alert-box success'>";
          print "<strong>Success!</strong>";
          print "<p>";
          print $successMsg;
          print "</p>";
          print "</div>";
      }
      ?>
   <div id="containerMinDoNotReplace">
      <div id="mainContentNoSidebarDoNotReplace">
         <div>
            <p><img src="/resources/img/logoBanner.png" alt="KAT Banner"/></p><!-- Bannger -->
            <hr />
            <?php include 'navigation.php';?><!-- Navigation Bar -->
         </div>
		 <!-- Main Selection -->
         <div>
            <form class="clear" action="/index.php/kat/route" method="POST">
               <fieldset>
                  <legend>Select Route</legend>
                  <label for="route">Route</label>
                  <select name="routeSelect">
                  
                  <?php
                     foreach($routes as $route){//Generate a list of routes from database
                         print "<option value='{$route['route']}|{$route['direction']}'>Route {$route['route']} - {$route['direction']} </option>";
                     }
                     
                     ?>
                  </select>
                  <br />
                  <?php
                  if($_SESSION['realm'] == 'Admin'){//Check if the admin 
                         //Fake button which isn't submitted unless the user verifies that he/she wants to delete the route
                         print "<input id='delete' style='display:none;' value='Delete Route' name='Delete Route' type='submit' onclick = \"verify()\">";
                         print "<button type='button' class=' blue reducedButton' value='Delete Route' name='Delete Route' onclick = \"triggerDelete()\">Delete Route</button>";
                         print "<input class=' blue reducedButton' value='Add Route' name='Add Route' type='submit'>";
                     }
                  ?>
                 <br />
				 <!-- ----------Buttons------------- -->
                  <input class="right blue button" value="Select Route" name="Select Route" type="submit"><!-- Select Button -->
				  <!-- ---------End Buttons--------- -->
               </fieldset>
            </form>
         </div>
		 <!-- End Main Selection -->
      </div>
   </div>
</body>
